package com.ljx.rabbit.service.impl;

import com.ljx.rabbit.domain.po.Banner;
import com.ljx.rabbit.domain.vo.BannerVo;
import com.ljx.rabbit.mapper.BannerMapper;
import com.ljx.rabbit.service.IBannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 轮播图 服务实现类
 * </p>
 *
 * @author author
 * @since 2025-01-20
 */
@Service
@Slf4j
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements IBannerService {

    @Override
    public List<BannerVo> listByDistributionSite(Integer distributionSite) {
        distributionSite=1;
        List<BannerVo> list1=new ArrayList<>();
        if(distributionSite==1){
            List<Banner> list = lambdaQuery().eq(Banner::getDistributionSite, distributionSite).list();
            for (Banner banner : list) {
                BannerVo bannerVo=new BannerVo();
                BeanUtils.copyProperties(banner,bannerVo);
                list1.add(bannerVo);
            }
        }else {
            //TODO 需要传category id过来 查item表
        }


        return list1;
    }
}
